package com.dongdongshop.controller;

import com.dongdongshop.admin.vo.ItemVO;
import com.dongdongshop.common.Result;
import com.dongdongshop.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("item")
public class ItemController {
    @Autowired
    private ItemService itemService;
    @PostMapping("getItemById")
    public Result getItemById(@RequestParam Long itemId){
        ItemVO itemVO = itemService.getItemById(itemId);
        return Result.OK().setData(itemVO);
    }
    @PostMapping("subStockCount")
    public Result subStockCount(@RequestBody List<ItemVO> itemVOList){
        itemService.subStockCount(itemVOList);
        return Result.OK();
    }
}
